/**
 * Copyright (c) 2012, http://www.yissugames.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.yissugames.blocklife;

import com.yissugames.gui.Event;
import com.yissugames.gui.GUI;
import com.yissugames.gui.TextBox;
import com.yissugames.gui.XMLScreen;

public class NewWorldScreen extends XMLScreen {

	public NewWorldScreen() {
		super("NewWorld");
		getButton("cancel").setEvent(new Event() {
			@Override
			public void onClick(GUI b) {
				ScreenSystem.set(new MainMenuScreen());
			}

			@Override
			public void onRightClick(GUI g) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onStateChanged(GUI g, boolean state) {
				// TODO Auto-generated method stub
				
			}
		});
		getButton("create").setEvent(new Event() {
			@Override
			public void onClick(GUI b) {
				TextBox txtBox = (TextBox) getObjectByTypeAndId(GUIType.TextBox, 1);
				String seed = txtBox.getContent();
				if(seed.isEmpty())
					seed = ((Long) System.currentTimeMillis()).toString();
				ScreenSystem.set(new GameScreen(seed));
			}

			@Override
			public void onRightClick(GUI g) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onStateChanged(GUI g, boolean state) {
				// TODO Auto-generated method stub
				
			}
		});
	}

	@Override
	public void onClick(int i) {
		// TODO Auto-generated method stub
	}

	@Override
	public void specialRender() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean specialInit() {
		// TODO Auto-generated method stub
		return true;
	}

}
